<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/6/28
 * Time: 15:16
 */
$studentName=$_POST['studentName'];
$studentSex=$_POST['studentSex'];
$studentBirth=$_POST['studentBirth'];
$studentAddress=$_POST['studentAddress'];
$studentStatus=$_POST['studentStatus'];
//var_dump($_POST);

$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");

$sql="insert into Student(StudentName,StudentSex,StudentBirth,StudentAddress,StudentStatus)
values('{$studentName}','{$studentSex}','{$studentBirth}','$studentAddress','$studentStatus')";
$result = $db->exec($sql);
var_dump($result);
if ($result){
    echo "增加成功,前往<a href='studentList.php'>列表页</a>";
}else{
    echo "增加失败,前往<a href='studentList.php'>列表页</a>";
}